#ifndef __STD_TCPSERVICE_H_
#define __STD_TCPSERVICE_H_
#include<stdio.h>
#include<iostream>
#include<string>
#include<memory>
/*通信类*/
class StdTcpSocket
{
public:

public:
    /*连接服务器*/
    bool conectToServer(const char*ip,int port);
    /*发送数据*/
    int sendMessage(const void *sendMsg,size_t size);
    /*发送数据2*/
    int sendMessage(const std::string &sendMsg);
    /*接收数据*/
    int receMessage(void *buf,size_t size);
    /*接受数据2*/
    int receMessage(std::string& receMessage);


    /*设置通信句柄*/
    void  setConnfdAttr(int connfd);

private:
    int m_connfd;



};


/*服务器类*/
class StdTcpService
{
public:
    /*设置监听*/
    void  setListen(int port);



    /*得到与客户端的通信句柄类*/
    std::shared_ptr<StdTcpSocket> getClientSock();
private:
    int m_port;

    int m_sockfd;


};











































#endif